package com.xcity.pomelo.response;

import java.util.ArrayList;
import java.util.List;

import com.xcity.game.battle.pve.PVEStageDropListener;
import com.xcity.game.common.ItemResponse;
import com.xcity.game.item.ItemTemplate;

import naga.x.App;
import naga.x.game.template.TemplateService;
import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class PVESweepResponse extends Response{

	private int id;
	private int leftCount;
	private List<Integer> sweepCounts;
//	private int money;
//	private int exp;
//	private List<ItemResponse> items;
	private List<SweepRewards> rewardList;
	
	public static class SweepRewards{
		public int money;
		public int exp;
		public List<ItemResponse> items;
		public SweepRewards(PVEStageDropListener listener){
			this.money = listener.getMoney();
			this.exp = listener.getExp();
//			TemplateService ts = App.getApp().getServiceManager().get(TemplateService.class);
//			for(int i = 0; i < items.size(); i++){
//				ItemResponse item = items.get(i);
//				ItemTemplate itemTemp = ts.get(ItemTemplate.class, item.getId());
//				if(itemTemp != null){
//					item.setName(itemTemp.getName());
//					item.setDesc(itemTemp.getDesc());
//					item.setIcon(itemTemp.getIcon());
//				}
//			}
			this.items = listener.getItems();
		}
	}
	
	public PVESweepResponse(int serial, int id, int leftCount, List<Integer> vipSweepCount, List<PVEStageDropListener> listenerList) {
		super(serial);
		this.id = id;
		this.leftCount = leftCount;
		this.sweepCounts = vipSweepCount;
		
		rewardList = new ArrayList<SweepRewards>();
		for(int i = 0; i < listenerList.size(); i++){
			SweepRewards reward = new SweepRewards(listenerList.get(i));
			rewardList.add(reward);
		}
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getLeftCount() {
		return leftCount;
	}
	public void setLeftCount(int leftCount) {
		this.leftCount = leftCount;
	}
	public List<Integer> getSweepCounts() {
		return sweepCounts;
	}
	public void setSweepCounts(List<Integer> sweepCounts) {
		this.sweepCounts = sweepCounts;
	}
	public List<SweepRewards> getRewardList() {
		return rewardList;
	}
	public void setRewardList(List<SweepRewards> rewardList) {
		this.rewardList = rewardList;
	}
}
